@echo off
del /f tkjmdict.exe > nul 2>&1
if exist tkjmdict.exe (
   echo ERROR: deleting tkjmdict.exe failed
   exit /b 1
)
del /f *.bin > nul 2>&1
dir *.bin > nul 2>&1
if [0] == [%ERRORLEVEL%] (
   echo ERROR: deleting dictionary files failed
   exit /b 1
)
copy tkjmdict tkjmdit.tcl
tclsh tkjmdict.tcl -parse JMdict
if not [0] == [%ERRORLEVEL%] (
   echo ERROR: parsing failed
   del /f tkjmdit.tcl
   exit /b 1
)
freewrap tkjmdict.tcl jmdict_eng.bin jmdict_fre.bin jmdict_ger.bin jmdict_rus.bin jmdict.log
if not exist tkjmdict.exe (
   echo ERROR: creating tkjmdict.exe failed
   del /f tkjmdit.tcl
   exit /b 1
)
del /f tkjmdit.tcl
start tkjmdict.exe




